
import { InbizIcon } from '@inbiz/utils'


type IValueSource = 'input' | 'comp' | 'content';

interface IValueModel {
  field: string;
  type: IValueSource,
  value: string;
}

interface IValueInter {
  cls: string;
  onChange?: (value: IValueModel) => void;
  addItem?: () => void;
  delItem?: () => void;
}

interface IButtonGroups extends IValueInter {
  formValueLength: number;
}

/**
 * 按钮组组件
 * **/
export const ButtonGroups = (props: IButtonGroups) => {
  const cls = props.cls ? props.cls + '-buttongroup' : '';
  return <div className={cls} style={{
    marginLeft: 10
  }}>
    <InbizIcon type='icon-xinjian' onClick={() => {
      props.addItem?.()
    }}
      style={{
        marginRight: 15
      }}
    />
    {
      props.formValueLength > 1 && <InbizIcon type='icon-shanchu-h' onClick={() => {
        props.delItem?.()
      }} />
    }
  </div>
}